[ << previous ] [ index ] [ next >> ]

Debugger

The debug module is a tool for parsing the current file through the debugging window at the bottom of the Code Editor. On clicking the button, the debugging window opens under the code editor. It shows the Workbench opens a listener for port 9000. Afterwards, it executes php.exe or calls the URL when parsing via webserver. When a connection is made to port 9000 the message "Accepted connection from XDebug" is printed in the Debug::Output window. After initializing communications with the php process it halts on line 1.

Debugging Toolbar
Run - Start the current script and open the
debugging port to accept the connection.
Stop - Kill the current debugging session and close the debug port.
Step Over - Process the current line and move to the
next line in the current script, not stepping into any function calls.
Step Into - Follow the code into the current line's function call.
Step Out - Finish with the current scope and move to the
scope above, jumping out of the current function call
Run to Cursor - It will start debugging from the current cursor position.

The debugger window has four panels to show the communication with the XDebug module, to show the local variables of the current scope, to show static watched variables, and to show stack trace.

The Output panel shows the following information, once a connection with the Xdebug module is established.

 

The Locals panel shows the variables that are defined in the current scope. When the script is just being started you will see all of the values being "NULL" as they are in the image above.

When a variable name represents an array or object in PHP it will be shown with the '+' symbol to the left which can be clicked on to open the member elements.

 

This is an example of an expanded array display.

 

In this panel you can add specific variables to follow throughout the execution of the script. Adding watched variables can be done through the menu item under the Debug menu.

The final tab in the debugging window is for the Stack Trace.

In order to make Xdebug run on your PHP script, the following code needs to be inserted in your php.ini file. This is to be inserted at the end of the php.ini file:

[xdebug]
zend_extension_ts="C:\workbench\tools\php_xdebug.
. xdebug.auto_trace = On
xdebug.collect_params = On
xdebug.default_enable = On
xdebug.remote_enable = On
xdebug.remote_handler = gdb
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.dump_once = On
xdebug.dump_undefined = On

zend_extension_ts may need to be changed in accordance with the path to php_xdebug.

[ << previous ] [ index ] [ next >> ]